
import Toastify from '../util/toastify';
export type ToastType = "default" | "danger" | "warning" | "info" | "success";
export function toast(msg: string, type: ToastType = "danger", timeout: number = 2000) {
    let background="linear-gradient(135deg, #73a5ff, #1a4bff)";
    if (type==="warning") {
      background="linear-gradient(135deg, #faa476, #ff5405)"
    } else if (type==="danger") {
      background="linear-gradient(135deg, #ff8989, #ff0000)"
    } else if (type=="success") {
      background="linear-gradient(135deg, #57965a, #027411)"
    }
  Toastify({ text: msg, duration: timeout,style:{background} }).showToast();
}

export function danger(msg: string, timeout: number = 2000) {
  toast(msg, "danger", timeout)
}

export function warning(msg: string, timeout: number = 2000) {
  toast(msg, "warning", timeout)
}

export function info(msg: string, timeout: number = 2000) {
  toast(msg, "info", timeout)
}

export function success(msg: string, timeout: number = 2000) {
  toast(msg, "success", timeout)
}